package com.luhe.musicxml.v1.part.measure.note;

import com.luhe.musicxml.annotion.Node;
import com.luhe.musicxml.annotion.XmlNode;
import com.luhe.musicxml.v1.part.measure.note.chord.Chord;
import com.luhe.musicxml.v1.part.measure.note.dot.Dot;
import com.luhe.musicxml.v1.part.measure.note.duration.Duration;
import com.luhe.musicxml.v1.part.measure.note.grace.Grace;
import com.luhe.musicxml.v1.part.measure.note.pitch.Alter;
import com.luhe.musicxml.v1.part.measure.note.pitch.Octave;
import com.luhe.musicxml.v1.part.measure.note.pitch.Pitch;
import com.luhe.musicxml.v1.part.measure.note.pitch.Step;
import com.luhe.musicxml.v1.part.measure.note.rest.Rest;
import com.luhe.musicxml.v1.part.measure.note.staff.Staff;
import com.luhe.musicxml.v1.part.measure.note.type.Type;

//音符
@XmlNode(name = "note")
public class Note extends Node {

    //音乐
    Pitch pitch;

    //类型
    Type type;


    Staff staff;

    Step step;

    //
    Alter alter;

    //
    Octave octave;

    //付点标记
    Dot dot;

    Duration duration;

    //和弦
    Chord chord;

    //倚音
    Grace grace;
    public Note addPitch(Step step, Alter alter, Octave octave) {
        Pitch pitch = new Pitch();
        pitch.addStep(step);
        pitch.addAlter(alter);
        pitch.addOctave(octave);
        this.nodeList.add(pitch);
        return this;
    }


    public Note addPitch(Pitch pitch) {
        this.nodeList.add(pitch);
        return this;
    }

    public Note addType(String type){
        Type type1=new Type(type);
        return  addType(type1);
    }
    public Note addType(Type type) {
        this.nodeList.add(type);
        return this;
    }


    public Note addStaff(int staff){
        Staff staff1=new Staff(staff);
        return addStaff(staff1);
    }

    public Note addStaff(Staff staff) {
        this.nodeList.add(staff);
        return this;
    }

    public Note addDuration(int duration) {
        Duration duration1 = new Duration(duration);
        return addDuration(duration1);
    }

    public Note addDuration(Duration duration) {
        this.nodeList.add(duration);
        return this;
    }

    //和弦标记
    public Note addChord(Chord chord) {
        this.nodeList.add(chord);
        return this;
    }

    //附点标记
    public Note addDot(Dot dot) {
        this.nodeList.add(dot);
        return this;
    }

    //倚音标记
    public Note addGrace(Grace grace) {
        this.nodeList.add(grace);
        return this;
    }


    //休止符标记
    public Note addRest(Rest rest) {
        this.nodeList.add(rest);
        return this;
    }

}
